<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
<meta http-equiv="X-UA-Compatible" content="IE=9"/>
<meta name="generator" content="Doxygen 1.8.10"/>
<title>sock: E:/git/sock/sock/net/tcp_server.h Source File</title>
<link href="tabs.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="jquery.js"></script>
<script type="text/javascript" src="dynsections.js"></script>
<link href="search/search.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="search/searchdata.js"></script>
<script type="text/javascript" src="search/search.js"></script>
<script type="text/javascript">
  $(document).ready(function() { init_search(); });
</script>
<link href="doxygen.css" rel="stylesheet" type="text/css" />
</head>
<body>
<div id="top"><!-- do not remove this div, it is closed by doxygen! -->
<div id="titlearea">
<table cellspacing="0" cellpadding="0">
 <tbody>
 <tr style="height: 56px;">
  <td id="projectalign" style="padding-left: 0.5em;">
   <div id="projectname">sock
   &#160;<span id="projectnumber">v0.11</span>
   </div>
   <div id="projectbrief">C++ Network Library</div>
  </td>
 </tr>
 </tbody>
</table>
</div>
<!-- end header part -->
<!-- Generated by Doxygen 1.8.10 -->
<script type="text/javascript">
var searchBox = new SearchBox("searchBox", "search",false,'Search');
</script>
  <div id="navrow1" class="tabs">
    <ul class="tablist">
      <li><a href="index.html"><span>Main&#160;Page</span></a></li>
      <li><a href="pages.html"><span>Related&#160;Pages</span></a></li>
      <li><a href="namespaces.html"><span>Namespaces</span></a></li>
      <li><a href="annotated.html"><span>Classes</span></a></li>
      <li class="current"><a href="files.html"><span>Files</span></a></li>
      <li>
        <div id="MSearchBox" class="MSearchBoxInactive">
        <span class="left">
          <img id="MSearchSelect" src="search/mag_sel.png"
               onmouseover="return searchBox.OnSearchSelectShow()"
               onmouseout="return searchBox.OnSearchSelectHide()"
               alt=""/>
          <input type="text" id="MSearchField" value="Search" accesskey="S"
               onfocus="searchBox.OnSearchFieldFocus(true)" 
               onblur="searchBox.OnSearchFieldFocus(false)" 
               onkeyup="searchBox.OnSearchFieldChange(event)"/>
          </span><span class="right">
            <a id="MSearchClose" href="javascript:searchBox.CloseResultsWindow()"><img id="MSearchCloseImg" border="0" src="search/close.png" alt=""/></a>
          </span>
        </div>
      </li>
    </ul>
  </div>
  <div id="navrow2" class="tabs2">
    <ul class="tablist">
      <li><a href="files.html"><span>File&#160;List</span></a></li>
      <li><a href="globals.html"><span>File&#160;Members</span></a></li>
    </ul>
  </div>
<!-- window showing the filter options -->
<div id="MSearchSelectWindow"
     onmouseover="return searchBox.OnSearchSelectShow()"
     onmouseout="return searchBox.OnSearchSelectHide()"
     onkeydown="return searchBox.OnSearchSelectKey(event)">
</div>

<!-- iframe showing the search results (closed by default) -->
<div id="MSearchResultsWindow">
<iframe src="javascript:void(0)" frameborder="0" 
        name="MSearchResults" id="MSearchResults">
</iframe>
</div>

<div id="nav-path" class="navpath">
  <ul>
<li class="navelem"><a class="el" href="dir_885cc87fac2d91e269af0a5a959fa5f6.html">E:</a></li><li class="navelem"><a class="el" href="dir_4e091ed8704426a7a4980368ba259fde.html">git</a></li><li class="navelem"><a class="el" href="dir_99ede9081e3122cb31ab1bd7b142cd6c.html">sock</a></li><li class="navelem"><a class="el" href="dir_7c33e989e8c050d7b2ba91a16c41033d.html">sock</a></li><li class="navelem"><a class="el" href="dir_d903d5916af6fe48bd2085e947d1c878.html">net</a></li>  </ul>
</div>
</div><!-- top -->
<div class="header">
  <div class="headertitle">
<div class="title">tcp_server.h</div>  </div>
</div><!--header-->
<div class="contents">
<a href="tcp__server_8h.html">Go to the documentation of this file.</a><div class="fragment"><div class="line"><a name="l00001"></a><span class="lineno">    1</span>&#160;<span class="comment">/******************************************************************************</span></div>
<div class="line"><a name="l00002"></a><span class="lineno">    2</span>&#160;<span class="comment"> * Name         : tcp_server.h</span></div>
<div class="line"><a name="l00003"></a><span class="lineno">    3</span>&#160;<span class="comment"> * Author       : 671643387</span></div>
<div class="line"><a name="l00004"></a><span class="lineno">    4</span>&#160;<span class="comment"> * Date         : 2015年10月6日</span></div>
<div class="line"><a name="l00005"></a><span class="lineno">    5</span>&#160;<span class="comment"> * Description  :</span></div>
<div class="line"><a name="l00006"></a><span class="lineno">    6</span>&#160;<span class="comment"> *****************************************************************************/</span></div>
<div class="line"><a name="l00007"></a><span class="lineno">    7</span>&#160;</div>
<div class="line"><a name="l00008"></a><span class="lineno">    8</span>&#160;<span class="preprocessor">#ifndef SOCK_NET_TCP_SERVER_H_</span></div>
<div class="line"><a name="l00009"></a><span class="lineno">    9</span>&#160;<span class="preprocessor">#define SOCK_NET_TCP_SERVER_H_</span></div>
<div class="line"><a name="l00010"></a><span class="lineno">   10</span>&#160;</div>
<div class="line"><a name="l00011"></a><span class="lineno">   11</span>&#160;<span class="preprocessor">#include &lt;vector&gt;</span></div>
<div class="line"><a name="l00012"></a><span class="lineno">   12</span>&#160;<span class="preprocessor">#include &lt;boost/noncopyable.hpp&gt;</span></div>
<div class="line"><a name="l00013"></a><span class="lineno">   13</span>&#160;<span class="preprocessor">#include &lt;boost/unordered_map.hpp&gt;</span></div>
<div class="line"><a name="l00014"></a><span class="lineno">   14</span>&#160;<span class="preprocessor">#include &lt;<a class="code" href="atomic_8h.html">sock/base/atomic.h</a>&gt;</span></div>
<div class="line"><a name="l00015"></a><span class="lineno">   15</span>&#160;<span class="preprocessor">#include &lt;<a class="code" href="mutex_8h.html">sock/base/mutex.h</a>&gt;</span></div>
<div class="line"><a name="l00016"></a><span class="lineno">   16</span>&#160;<span class="preprocessor">#include &lt;<a class="code" href="event__loop_8h.html">sock/net/event_loop.h</a>&gt;</span></div>
<div class="line"><a name="l00017"></a><span class="lineno">   17</span>&#160;<span class="preprocessor">#include &lt;<a class="code" href="tcp__acceptor_8h.html">sock/net/tcp_acceptor.h</a>&gt;</span></div>
<div class="line"><a name="l00018"></a><span class="lineno">   18</span>&#160;<span class="preprocessor">#include &lt;<a class="code" href="tcp__connection_8h.html">sock/net/tcp_connection.h</a>&gt;</span></div>
<div class="line"><a name="l00019"></a><span class="lineno">   19</span>&#160;<span class="preprocessor">#include &lt;<a class="code" href="tcp__connection__factory_8h.html">sock/net/tcp_connection_factory.h</a>&gt;</span></div>
<div class="line"><a name="l00020"></a><span class="lineno">   20</span>&#160;<span class="preprocessor">#include &lt;<a class="code" href="tcp__worker_8h.html">sock/net/tcp_worker.h</a>&gt;</span></div>
<div class="line"><a name="l00021"></a><span class="lineno">   21</span>&#160;</div>
<div class="line"><a name="l00022"></a><span class="lineno">   22</span>&#160;<span class="keyword">namespace </span><a class="code" href="namespacesock.html">sock</a></div>
<div class="line"><a name="l00023"></a><span class="lineno">   23</span>&#160;{</div>
<div class="line"><a name="l00024"></a><span class="lineno">   24</span>&#160;    <span class="keyword">namespace </span>net</div>
<div class="line"><a name="l00025"></a><span class="lineno">   25</span>&#160;    {</div>
<div class="line"><a name="l00029"></a><span class="lineno"><a class="line" href="classsock_1_1net_1_1_tcp_server.html">   29</a></span>&#160;        <span class="keyword">class </span><a class="code" href="classsock_1_1net_1_1_tcp_server.html">TcpServer</a> : <span class="keyword">public</span> boost::noncopyable</div>
<div class="line"><a name="l00030"></a><span class="lineno">   30</span>&#160;        {</div>
<div class="line"><a name="l00031"></a><span class="lineno">   31</span>&#160;        <span class="keyword">public</span>:</div>
<div class="line"><a name="l00032"></a><span class="lineno">   32</span>&#160;        </div>
<div class="line"><a name="l00033"></a><span class="lineno">   33</span>&#160;</div>
<div class="line"><a name="l00034"></a><span class="lineno">   34</span>&#160;        <span class="keyword">public</span>:</div>
<div class="line"><a name="l00038"></a><span class="lineno"><a class="line" href="classsock_1_1net_1_1_tcp_server.html#abec9ec73a9e95554ec1dd46ebcebb26c">   38</a></span>&#160;            <span class="keyword">enum</span> <a class="code" href="classsock_1_1net_1_1_tcp_server.html#abec9ec73a9e95554ec1dd46ebcebb26c">Options</a></div>
<div class="line"><a name="l00039"></a><span class="lineno">   39</span>&#160;            {</div>
<div class="line"><a name="l00040"></a><span class="lineno"><a class="line" href="classsock_1_1net_1_1_tcp_server.html#abec9ec73a9e95554ec1dd46ebcebb26cae14a3e48f9466cf5533f6501065e5d8f">   40</a></span>&#160;                <a class="code" href="classsock_1_1net_1_1_tcp_server.html#abec9ec73a9e95554ec1dd46ebcebb26cae14a3e48f9466cf5533f6501065e5d8f">WORKER_NUM</a>,         <span class="comment">/* 工作线程数量 */</span></div>
<div class="line"><a name="l00041"></a><span class="lineno"><a class="line" href="classsock_1_1net_1_1_tcp_server.html#abec9ec73a9e95554ec1dd46ebcebb26ca52b8a6d182527f5cbf89ce8fcebd6b6b">   41</a></span>&#160;                <a class="code" href="classsock_1_1net_1_1_tcp_server.html#abec9ec73a9e95554ec1dd46ebcebb26ca52b8a6d182527f5cbf89ce8fcebd6b6b">HEARTBEAT_TIME</a>,     <span class="comment">/* 心跳时间 */</span></div>
<div class="line"><a name="l00042"></a><span class="lineno"><a class="line" href="classsock_1_1net_1_1_tcp_server.html#abec9ec73a9e95554ec1dd46ebcebb26ca4b64346c3e4b3ae76cf612e103d98638">   42</a></span>&#160;                <a class="code" href="classsock_1_1net_1_1_tcp_server.html#abec9ec73a9e95554ec1dd46ebcebb26ca4b64346c3e4b3ae76cf612e103d98638">FRAME_TIME</a>,         <span class="comment">/* 线程帧时间 */</span></div>
<div class="line"><a name="l00043"></a><span class="lineno"><a class="line" href="classsock_1_1net_1_1_tcp_server.html#abec9ec73a9e95554ec1dd46ebcebb26ca0eb2364f1f8f1ee1f86670d030370bb3">   43</a></span>&#160;                <a class="code" href="classsock_1_1net_1_1_tcp_server.html#abec9ec73a9e95554ec1dd46ebcebb26ca0eb2364f1f8f1ee1f86670d030370bb3">CONN_ISSIZE</a>,        <span class="comment">/* 连接输入流大小 */</span></div>
<div class="line"><a name="l00044"></a><span class="lineno"><a class="line" href="classsock_1_1net_1_1_tcp_server.html#abec9ec73a9e95554ec1dd46ebcebb26cad2dd1e3c9592315e4a98df0519c3b299">   44</a></span>&#160;                <a class="code" href="classsock_1_1net_1_1_tcp_server.html#abec9ec73a9e95554ec1dd46ebcebb26cad2dd1e3c9592315e4a98df0519c3b299">CONN_OSSIZE</a>,        <span class="comment">/* 连接输出流大小 */</span></div>
<div class="line"><a name="l00045"></a><span class="lineno">   45</span>&#160;            };</div>
<div class="line"><a name="l00046"></a><span class="lineno">   46</span>&#160;</div>
<div class="line"><a name="l00050"></a><span class="lineno"><a class="line" href="classsock_1_1net_1_1_tcp_server.html#afb7b447f9f67ed9f1a3f93e15f43b347">   50</a></span>&#160;            <span class="keyword">enum</span> <a class="code" href="classsock_1_1net_1_1_tcp_server.html#afb7b447f9f67ed9f1a3f93e15f43b347">State</a></div>
<div class="line"><a name="l00051"></a><span class="lineno">   51</span>&#160;            {</div>
<div class="line"><a name="l00052"></a><span class="lineno"><a class="line" href="classsock_1_1net_1_1_tcp_server.html#afb7b447f9f67ed9f1a3f93e15f43b347ae78386eefc569f2c07c58b66cb0751da">   52</a></span>&#160;                <a class="code" href="classsock_1_1net_1_1_tcp_server.html#afb7b447f9f67ed9f1a3f93e15f43b347ae78386eefc569f2c07c58b66cb0751da">READY</a>,              <span class="comment">/* 就绪 */</span></div>
<div class="line"><a name="l00053"></a><span class="lineno"><a class="line" href="classsock_1_1net_1_1_tcp_server.html#afb7b447f9f67ed9f1a3f93e15f43b347add196db3e514c0fa131ec4b2e36ec25b">   53</a></span>&#160;                <a class="code" href="classsock_1_1net_1_1_tcp_server.html#afb7b447f9f67ed9f1a3f93e15f43b347add196db3e514c0fa131ec4b2e36ec25b">RUNNING</a>,            <span class="comment">/* 运行中 */</span></div>
<div class="line"><a name="l00054"></a><span class="lineno"><a class="line" href="classsock_1_1net_1_1_tcp_server.html#afb7b447f9f67ed9f1a3f93e15f43b347ad1b2046ce4c56bad7b7a9a090a7e2021">   54</a></span>&#160;                <a class="code" href="classsock_1_1net_1_1_tcp_server.html#afb7b447f9f67ed9f1a3f93e15f43b347ad1b2046ce4c56bad7b7a9a090a7e2021">EXITING</a>,            <span class="comment">/* 退出中 */</span></div>
<div class="line"><a name="l00055"></a><span class="lineno"><a class="line" href="classsock_1_1net_1_1_tcp_server.html#afb7b447f9f67ed9f1a3f93e15f43b347a0216946439f9bc60432110c9e2da378d">   55</a></span>&#160;                <a class="code" href="classsock_1_1net_1_1_tcp_server.html#afb7b447f9f67ed9f1a3f93e15f43b347a0216946439f9bc60432110c9e2da378d">EXIT</a>                <span class="comment">/* 已退出 */</span></div>
<div class="line"><a name="l00056"></a><span class="lineno">   56</span>&#160;            };</div>
<div class="line"><a name="l00057"></a><span class="lineno">   57</span>&#160;</div>
<div class="line"><a name="l00061"></a><span class="lineno"><a class="line" href="structsock_1_1net_1_1_tcp_server_1_1_statics.html">   61</a></span>&#160;            <span class="keyword">struct </span><a class="code" href="structsock_1_1net_1_1_tcp_server_1_1_statics.html">Statics</a></div>
<div class="line"><a name="l00062"></a><span class="lineno">   62</span>&#160;            {</div>
<div class="line"><a name="l00063"></a><span class="lineno">   63</span>&#160;                <span class="comment">// 服务器数据</span></div>
<div class="line"><a name="l00064"></a><span class="lineno"><a class="line" href="structsock_1_1net_1_1_tcp_server_1_1_statics.html#aa5eedbb8f4e72c3a1f18e316d14d9fb3">   64</a></span>&#160;                <span class="keywordtype">int</span> <a class="code" href="structsock_1_1net_1_1_tcp_server_1_1_statics.html#aa5eedbb8f4e72c3a1f18e316d14d9fb3">connectionIdGen</a>;            <span class="comment">/* 服务器ID分配 */</span></div>
<div class="line"><a name="l00065"></a><span class="lineno"><a class="line" href="structsock_1_1net_1_1_tcp_server_1_1_statics.html#aed675a9fca0ac458c12e579ea5fecbd6">   65</a></span>&#160;                <span class="keywordtype">int</span> <a class="code" href="structsock_1_1net_1_1_tcp_server_1_1_statics.html#aed675a9fca0ac458c12e579ea5fecbd6">workers</a>;                    <span class="comment">/* 工作线程数量 */</span></div>
<div class="line"><a name="l00066"></a><span class="lineno"><a class="line" href="structsock_1_1net_1_1_tcp_server_1_1_statics.html#a3eadb0e652b53b813a432931b0212cd0">   66</a></span>&#160;                <span class="keywordtype">int</span> <a class="code" href="structsock_1_1net_1_1_tcp_server_1_1_statics.html#a3eadb0e652b53b813a432931b0212cd0">connections</a>;                <span class="comment">/* 服务器总连接数 */</span></div>
<div class="line"><a name="l00067"></a><span class="lineno"><a class="line" href="structsock_1_1net_1_1_tcp_server_1_1_statics.html#ab4487c2d93a326630fbbe9c5c9f9866a">   67</a></span>&#160;                <span class="keywordtype">unsigned</span> <span class="keywordtype">long</span> <span class="keywordtype">long</span> <a class="code" href="structsock_1_1net_1_1_tcp_server_1_1_statics.html#ab4487c2d93a326630fbbe9c5c9f9866a">bytsSend</a>;    <span class="comment">/* 总发送字节 */</span></div>
<div class="line"><a name="l00068"></a><span class="lineno"><a class="line" href="structsock_1_1net_1_1_tcp_server_1_1_statics.html#a36efcda737e698c67fca2d6ffc3952da">   68</a></span>&#160;                <span class="keywordtype">unsigned</span> <span class="keywordtype">long</span> <span class="keywordtype">long</span> <a class="code" href="structsock_1_1net_1_1_tcp_server_1_1_statics.html#a36efcda737e698c67fca2d6ffc3952da">bytsRecv</a>;    <span class="comment">/* 总接收字节 */</span></div>
<div class="line"><a name="l00069"></a><span class="lineno">   69</span>&#160;</div>
<div class="line"><a name="l00070"></a><span class="lineno">   70</span>&#160;                <span class="comment">// 线程数据</span></div>
<div class="line"><a name="l00071"></a><span class="lineno"><a class="line" href="structsock_1_1net_1_1_tcp_server_1_1_statics.html#a56f1b517fb896b77572d92904e9e1116">   71</a></span>&#160;                <span class="keywordtype">int</span> <a class="code" href="structsock_1_1net_1_1_tcp_server_1_1_statics.html#a56f1b517fb896b77572d92904e9e1116">connectionLoad</a>;                     <span class="comment">/* 服务器线程持有的连接数 */</span></div>
<div class="line"><a name="l00072"></a><span class="lineno"><a class="line" href="structsock_1_1net_1_1_tcp_server_1_1_statics.html#aaed29ec6015c7b06f1cc21ba46ce387d">   72</a></span>&#160;                <a class="code" href="structsock_1_1net_1_1_event_loop_1_1_statics.html">EventLoop::Statics</a> <a class="code" href="structsock_1_1net_1_1_tcp_server_1_1_statics.html#aaed29ec6015c7b06f1cc21ba46ce387d">eventLoopStatics</a>;    <span class="comment">/* 事件循环状态 */</span></div>
<div class="line"><a name="l00073"></a><span class="lineno">   73</span>&#160;</div>
<div class="line"><a name="l00074"></a><span class="lineno">   74</span>&#160;                <span class="comment">// 工作线程数据</span></div>
<div class="line"><a name="l00075"></a><span class="lineno"><a class="line" href="structsock_1_1net_1_1_tcp_server_1_1_statics.html#acb3fd493d39070b04c5ed59e40025b40">   75</a></span>&#160;                std::vector&lt;TcpWorker::Statics&gt; <a class="code" href="structsock_1_1net_1_1_tcp_server_1_1_statics.html#acb3fd493d39070b04c5ed59e40025b40">workerStatics</a>;  <span class="comment">/* 工作线程状态 */</span></div>
<div class="line"><a name="l00076"></a><span class="lineno">   76</span>&#160;            };</div>
<div class="line"><a name="l00077"></a><span class="lineno">   77</span>&#160;</div>
<div class="line"><a name="l00081"></a><span class="lineno"><a class="line" href="structsock_1_1net_1_1_tcp_server_1_1_config.html">   81</a></span>&#160;            <span class="keyword">struct </span><a class="code" href="structsock_1_1net_1_1_tcp_server_1_1_config.html">Config</a></div>
<div class="line"><a name="l00082"></a><span class="lineno">   82</span>&#160;            {</div>
<div class="line"><a name="l00083"></a><span class="lineno"><a class="line" href="structsock_1_1net_1_1_tcp_server_1_1_config.html#a6591de0bfd776b4496665c89c7a0bd82">   83</a></span>&#160;                <span class="keywordtype">int</span> <a class="code" href="structsock_1_1net_1_1_tcp_server_1_1_config.html#a6591de0bfd776b4496665c89c7a0bd82">workers</a>;                        <span class="comment">/* 配置的工作线程 */</span></div>
<div class="line"><a name="l00084"></a><span class="lineno"><a class="line" href="structsock_1_1net_1_1_tcp_server_1_1_config.html#a735d7b1eb8613f87f4c2fb68b5c02bee">   84</a></span>&#160;                base::mtime_t <a class="code" href="structsock_1_1net_1_1_tcp_server_1_1_config.html#a735d7b1eb8613f87f4c2fb68b5c02bee">frameTime</a>;            <span class="comment">/* 帧时间 */</span></div>
<div class="line"><a name="l00085"></a><span class="lineno"><a class="line" href="structsock_1_1net_1_1_tcp_server_1_1_config.html#a854b878563895cec9e925d50944c2bc1">   85</a></span>&#160;                base::mtime_t <a class="code" href="structsock_1_1net_1_1_tcp_server_1_1_config.html#a854b878563895cec9e925d50944c2bc1">heartbeatTime</a>;        <span class="comment">/* 心跳时间 */</span></div>
<div class="line"><a name="l00086"></a><span class="lineno"><a class="line" href="structsock_1_1net_1_1_tcp_server_1_1_config.html#a12200d1af83c28b39456346cbb4f8dd7">   86</a></span>&#160;                <span class="keywordtype">size_t</span> <a class="code" href="structsock_1_1net_1_1_tcp_server_1_1_config.html#a12200d1af83c28b39456346cbb4f8dd7">connectionIsSize</a>;            <span class="comment">/* 连接输入流大小 */</span></div>
<div class="line"><a name="l00087"></a><span class="lineno"><a class="line" href="structsock_1_1net_1_1_tcp_server_1_1_config.html#a9c3eb6b189903fa17f12e44ea5cd78e7">   87</a></span>&#160;                <span class="keywordtype">size_t</span> <a class="code" href="structsock_1_1net_1_1_tcp_server_1_1_config.html#a9c3eb6b189903fa17f12e44ea5cd78e7">connectionOsSize</a>;            <span class="comment">/* 连接输出流大小 */</span></div>
<div class="line"><a name="l00088"></a><span class="lineno">   88</span>&#160;            };</div>
<div class="line"><a name="l00089"></a><span class="lineno">   89</span>&#160;</div>
<div class="line"><a name="l00090"></a><span class="lineno">   90</span>&#160;        <span class="keyword">public</span>:</div>
<div class="line"><a name="l00091"></a><span class="lineno">   91</span>&#160;            <a class="code" href="classsock_1_1net_1_1_tcp_server.html#ad6d1a8405d96f2479c297918c396d212">TcpServer</a>(<span class="keywordtype">void</span>);</div>
<div class="line"><a name="l00092"></a><span class="lineno">   92</span>&#160;            <a class="code" href="classsock_1_1net_1_1_tcp_server.html#a226792a6bb7cccdb4eb6dfdf8851326c">~TcpServer</a>(<span class="keywordtype">void</span>);</div>
<div class="line"><a name="l00093"></a><span class="lineno">   93</span>&#160;</div>
<div class="line"><a name="l00094"></a><span class="lineno">   94</span>&#160;        <span class="keyword">public</span>:</div>
<div class="line"><a name="l00102"></a><span class="lineno">  102</span>&#160;            <span class="keywordtype">bool</span> <a class="code" href="classsock_1_1net_1_1_tcp_server.html#afc40c8a3ac309ae92182de21a014d4cd">open</a>(<span class="keyword">const</span> <span class="keywordtype">char</span>* addr, <span class="keywordtype">int</span> port, <span class="keywordtype">int</span> backlog);</div>
<div class="line"><a name="l00103"></a><span class="lineno">  103</span>&#160;</div>
<div class="line"><a name="l00107"></a><span class="lineno">  107</span>&#160;            <span class="keywordtype">void</span> <a class="code" href="classsock_1_1net_1_1_tcp_server.html#a750bc64764b1277beee95ba9231f0f08">run</a>(<span class="keywordtype">void</span>);</div>
<div class="line"><a name="l00108"></a><span class="lineno">  108</span>&#160;</div>
<div class="line"><a name="l00112"></a><span class="lineno">  112</span>&#160;            <span class="keywordtype">void</span> <a class="code" href="classsock_1_1net_1_1_tcp_server.html#a8858c03e9c473d4a8313315c267fef28">close</a>(<span class="keywordtype">void</span>);</div>
<div class="line"><a name="l00113"></a><span class="lineno">  113</span>&#160;</div>
<div class="line"><a name="l00119"></a><span class="lineno">  119</span>&#160;            <span class="keywordtype">void</span> <a class="code" href="classsock_1_1net_1_1_tcp_server.html#a604b0305e6e7c6766af27dbd5a8f2d24">config</a>(<a class="code" href="classsock_1_1net_1_1_tcp_server.html#abec9ec73a9e95554ec1dd46ebcebb26c">Options</a> optname, <span class="keywordtype">void</span>* optval);</div>
<div class="line"><a name="l00120"></a><span class="lineno">  120</span>&#160;</div>
<div class="line"><a name="l00125"></a><span class="lineno"><a class="line" href="classsock_1_1net_1_1_tcp_server.html#a4cd23b2b8566abc9d4f167b2c0488095">  125</a></span>&#160;            <span class="keywordtype">void</span> <a class="code" href="classsock_1_1net_1_1_tcp_server.html#a4cd23b2b8566abc9d4f167b2c0488095">setConnectionFactory</a>(<a class="code" href="namespacesock_1_1net.html#a2ddc58693b405832076a3d76dc133671">TcpConnectionFactoryPtr</a> factory) { connFactory_ = factory; }</div>
<div class="line"><a name="l00126"></a><span class="lineno">  126</span>&#160;</div>
<div class="line"><a name="l00131"></a><span class="lineno">  131</span>&#160;            <span class="keywordtype">void</span> <a class="code" href="classsock_1_1net_1_1_tcp_server.html#aa44d4d1608416e7fca8935090c5ef6ca">getStatics</a>(Statics&amp; statics);</div>
<div class="line"><a name="l00132"></a><span class="lineno">  132</span>&#160;</div>
<div class="line"><a name="l00137"></a><span class="lineno">  137</span>&#160;            <span class="keywordtype">void</span> <a class="code" href="classsock_1_1net_1_1_tcp_server.html#ac1ca3065af98af784c65622431db16b5">getConfig</a>(Config&amp; <a class="code" href="classsock_1_1net_1_1_tcp_server.html#a604b0305e6e7c6766af27dbd5a8f2d24">config</a>);</div>
<div class="line"><a name="l00138"></a><span class="lineno">  138</span>&#160;</div>
<div class="line"><a name="l00139"></a><span class="lineno">  139</span>&#160;        <span class="keyword">public</span>:</div>
<div class="line"><a name="l00144"></a><span class="lineno"><a class="line" href="classsock_1_1net_1_1_tcp_server.html#ab68be9fc6db7094c2b6ca6b1650399e3">  144</a></span>&#160;            <span class="keywordtype">void</span> <a class="code" href="classsock_1_1net_1_1_tcp_server.html#ab68be9fc6db7094c2b6ca6b1650399e3">setConnectionReadFN</a>(<a class="code" href="classsock_1_1net_1_1_tcp_connection.html#a836ed49de731537f208e17d07868a9d8">TcpConnection::TcpConnectionReadFunc</a> fn)</div>
<div class="line"><a name="l00145"></a><span class="lineno">  145</span>&#160;            {</div>
<div class="line"><a name="l00146"></a><span class="lineno">  146</span>&#160;                connReadFn_ = fn;</div>
<div class="line"><a name="l00147"></a><span class="lineno">  147</span>&#160;            }</div>
<div class="line"><a name="l00152"></a><span class="lineno"><a class="line" href="classsock_1_1net_1_1_tcp_server.html#ae950d0e397409f17f8eaeb2d191abdd6">  152</a></span>&#160;            <span class="keywordtype">void</span> <a class="code" href="classsock_1_1net_1_1_tcp_server.html#ae950d0e397409f17f8eaeb2d191abdd6">setConnectionWriteFN</a>(<a class="code" href="classsock_1_1net_1_1_tcp_connection.html#ab8951d995ac681b06a8d8dfdadd219aa">TcpConnection::TcpConnectionWriteFunc</a> fn)</div>
<div class="line"><a name="l00153"></a><span class="lineno">  153</span>&#160;            {</div>
<div class="line"><a name="l00154"></a><span class="lineno">  154</span>&#160;                connWriteFn_ = fn;</div>
<div class="line"><a name="l00155"></a><span class="lineno">  155</span>&#160;            }</div>
<div class="line"><a name="l00160"></a><span class="lineno"><a class="line" href="classsock_1_1net_1_1_tcp_server.html#a0641cbef81380437d1c420e9883a9840">  160</a></span>&#160;            <span class="keywordtype">void</span> <a class="code" href="classsock_1_1net_1_1_tcp_server.html#a0641cbef81380437d1c420e9883a9840">setConnectionErrorFN</a>(<a class="code" href="classsock_1_1net_1_1_tcp_connection.html#a9d9ea93c3a51141616167ae78c0238ec">TcpConnection::PassTcpConnectionRefFunc</a> fn)</div>
<div class="line"><a name="l00161"></a><span class="lineno">  161</span>&#160;            {</div>
<div class="line"><a name="l00162"></a><span class="lineno">  162</span>&#160;                connErrorFn_ = fn;</div>
<div class="line"><a name="l00163"></a><span class="lineno">  163</span>&#160;            }</div>
<div class="line"><a name="l00168"></a><span class="lineno"><a class="line" href="classsock_1_1net_1_1_tcp_server.html#a6fc6f8dc248d7338478316126bf37319">  168</a></span>&#160;            <span class="keywordtype">void</span> <a class="code" href="classsock_1_1net_1_1_tcp_server.html#a6fc6f8dc248d7338478316126bf37319">setConnectionCloseFN</a>(<a class="code" href="classsock_1_1net_1_1_tcp_connection.html#a9d9ea93c3a51141616167ae78c0238ec">TcpConnection::PassTcpConnectionRefFunc</a> fn)</div>
<div class="line"><a name="l00169"></a><span class="lineno">  169</span>&#160;            {</div>
<div class="line"><a name="l00170"></a><span class="lineno">  170</span>&#160;                connCloseFn_ = fn;</div>
<div class="line"><a name="l00171"></a><span class="lineno">  171</span>&#160;            }</div>
<div class="line"><a name="l00176"></a><span class="lineno"><a class="line" href="classsock_1_1net_1_1_tcp_server.html#add5343d5b2e2f7a7536fdb88a9dd4033">  176</a></span>&#160;            <span class="keywordtype">void</span> <a class="code" href="classsock_1_1net_1_1_tcp_server.html#add5343d5b2e2f7a7536fdb88a9dd4033">setConnectionHeartbeatFN</a>(<a class="code" href="classsock_1_1net_1_1_tcp_connection.html#a9d9ea93c3a51141616167ae78c0238ec">TcpConnection::PassTcpConnectionRefFunc</a> fn)</div>
<div class="line"><a name="l00177"></a><span class="lineno">  177</span>&#160;            {</div>
<div class="line"><a name="l00178"></a><span class="lineno">  178</span>&#160;                connHeartbeatFn_ = fn;</div>
<div class="line"><a name="l00179"></a><span class="lineno">  179</span>&#160;            }</div>
<div class="line"><a name="l00180"></a><span class="lineno">  180</span>&#160;</div>
<div class="line"><a name="l00184"></a><span class="lineno"><a class="line" href="classsock_1_1net_1_1_tcp_server.html#aed1da477683c9942e4c04f891b0050c5">  184</a></span>&#160;            <span class="keywordtype">void</span> <a class="code" href="classsock_1_1net_1_1_tcp_server.html#aed1da477683c9942e4c04f891b0050c5">setConnectionEstablishedFN</a>(<a class="code" href="classsock_1_1net_1_1_tcp_acceptor.html#a4f61b7c7e32c3cc975f394efbfced020">TcpAcceptor::PassTcpConnectionPtrRefFunc</a> fn)</div>
<div class="line"><a name="l00185"></a><span class="lineno">  185</span>&#160;            {</div>
<div class="line"><a name="l00186"></a><span class="lineno">  186</span>&#160;                connectionEstablishedFn_ = fn;</div>
<div class="line"><a name="l00187"></a><span class="lineno">  187</span>&#160;            }</div>
<div class="line"><a name="l00188"></a><span class="lineno">  188</span>&#160;</div>
<div class="line"><a name="l00189"></a><span class="lineno">  189</span>&#160;        <span class="keyword">private</span>:</div>
<div class="line"><a name="l00190"></a><span class="lineno">  190</span>&#160;            <span class="comment">//初始化工作线程</span></div>
<div class="line"><a name="l00191"></a><span class="lineno">  191</span>&#160;            <span class="keywordtype">bool</span> initWorkers(<span class="keywordtype">void</span>);</div>
<div class="line"><a name="l00192"></a><span class="lineno">  192</span>&#160;            <span class="comment">// 启动工作线程</span></div>
<div class="line"><a name="l00193"></a><span class="lineno">  193</span>&#160;            <span class="keywordtype">void</span> startWorkers(<span class="keywordtype">void</span>);</div>
<div class="line"><a name="l00194"></a><span class="lineno">  194</span>&#160;            <span class="comment">// 关闭工作线程</span></div>
<div class="line"><a name="l00195"></a><span class="lineno">  195</span>&#160;            <span class="keywordtype">void</span> closeWorkers(<span class="keywordtype">void</span>);</div>
<div class="line"><a name="l00196"></a><span class="lineno">  196</span>&#160;            <span class="comment">// 把连接绑定到服务器线程或者工作线程</span></div>
<div class="line"><a name="l00197"></a><span class="lineno">  197</span>&#160;            <span class="keywordtype">void</span> bindConnection(<a class="code" href="namespacesock_1_1net.html#ac7ab8c7fe4e8e023f2fea799b74122ed">TcpConnectionPtr</a>&amp; conn);</div>
<div class="line"><a name="l00198"></a><span class="lineno">  198</span>&#160;            <span class="comment">// 把连接绑定到服务器线程</span></div>
<div class="line"><a name="l00199"></a><span class="lineno">  199</span>&#160;            <span class="keywordtype">void</span> bindConnectionToMaster(<a class="code" href="namespacesock_1_1net.html#ac7ab8c7fe4e8e023f2fea799b74122ed">TcpConnectionPtr</a>&amp; conn);</div>
<div class="line"><a name="l00200"></a><span class="lineno">  200</span>&#160;</div>
<div class="line"><a name="l00201"></a><span class="lineno">  201</span>&#160;        <span class="keyword">private</span>:</div>
<div class="line"><a name="l00202"></a><span class="lineno">  202</span>&#160;            <span class="comment">// 创建TCP连接</span></div>
<div class="line"><a name="l00203"></a><span class="lineno">  203</span>&#160;            <a class="code" href="namespacesock_1_1net.html#ac7ab8c7fe4e8e023f2fea799b74122ed">TcpConnectionPtr</a>&amp; newTcpConnection(sock_t <a class="code" href="namespacesock.html">sock</a>);</div>
<div class="line"><a name="l00204"></a><span class="lineno">  204</span>&#160;            <span class="comment">// 新连接通知</span></div>
<div class="line"><a name="l00205"></a><span class="lineno">  205</span>&#160;            <span class="keywordtype">void</span> connectionEstablished(<a class="code" href="namespacesock_1_1net.html#ac7ab8c7fe4e8e023f2fea799b74122ed">TcpConnectionPtr</a>&amp; conn);</div>
<div class="line"><a name="l00206"></a><span class="lineno">  206</span>&#160;</div>
<div class="line"><a name="l00207"></a><span class="lineno">  207</span>&#160;        <span class="keyword">private</span>:</div>
<div class="line"><a name="l00208"></a><span class="lineno">  208</span>&#160;            <span class="comment">// 关闭服务器，步骤1，关闭接收器</span></div>
<div class="line"><a name="l00209"></a><span class="lineno">  209</span>&#160;            <span class="keywordtype">void</span> closeServerStep_closeAcceptor(<span class="keywordtype">void</span>);</div>
<div class="line"><a name="l00210"></a><span class="lineno">  210</span>&#160;</div>
<div class="line"><a name="l00211"></a><span class="lineno">  211</span>&#160;        <span class="keyword">private</span>:</div>
<div class="line"><a name="l00212"></a><span class="lineno"><a class="line" href="classsock_1_1net_1_1_tcp_server.html#a43fe1eaa6c6b4d4ecbb2ba361d312b66">  212</a></span>&#160;            <span class="keyword">friend</span> <span class="keyword">class </span><a class="code" href="classsock_1_1net_1_1_tcp_connection.html">TcpConnection</a>;</div>
<div class="line"><a name="l00213"></a><span class="lineno"><a class="line" href="classsock_1_1net_1_1_tcp_server.html#a0736aba6eec2f2c2a13494228473b67c">  213</a></span>&#160;            <span class="keyword">friend</span> <span class="keyword">class </span><a class="code" href="classsock_1_1net_1_1_tcp_worker.html">TcpWorker</a>;</div>
<div class="line"><a name="l00214"></a><span class="lineno">  214</span>&#160;            <span class="keywordtype">void</span> eraseConnection(<span class="keywordtype">int</span> <span class="keywordtype">id</span>);</div>
<div class="line"><a name="l00215"></a><span class="lineno">  215</span>&#160;            <span class="keywordtype">void</span> closeConnection(<a class="code" href="classsock_1_1net_1_1_tcp_connection.html">TcpConnection</a>* conn);</div>
<div class="line"><a name="l00216"></a><span class="lineno">  216</span>&#160;            <span class="keywordtype">void</span> doCloseConnection(<a class="code" href="classsock_1_1net_1_1_tcp_connection.html">TcpConnection</a>* conn);</div>
<div class="line"><a name="l00217"></a><span class="lineno">  217</span>&#160;            <span class="keywordtype">void</span> workerCloseConnection(<a class="code" href="classsock_1_1net_1_1_tcp_connection.html">TcpConnection</a>* conn);</div>
<div class="line"><a name="l00218"></a><span class="lineno">  218</span>&#160;            <span class="keywordtype">void</span> bindConnectionResult(<a class="code" href="namespacesock_1_1net.html#ac7ab8c7fe4e8e023f2fea799b74122ed">TcpConnectionPtr</a>&amp; conn, <span class="keywordtype">bool</span> ok);</div>
<div class="line"><a name="l00219"></a><span class="lineno">  219</span>&#160;            <span class="keywordtype">void</span> doBindConnectionResult(<a class="code" href="namespacesock_1_1net.html#ac7ab8c7fe4e8e023f2fea799b74122ed">TcpConnectionPtr</a>&amp; conn, <span class="keywordtype">bool</span> ok);</div>
<div class="line"><a name="l00220"></a><span class="lineno">  220</span>&#160;</div>
<div class="line"><a name="l00221"></a><span class="lineno">  221</span>&#160;            <span class="keywordtype">void</span> addSendByts(<span class="keywordtype">unsigned</span> <span class="keywordtype">long</span> <span class="keywordtype">long</span> v) </div>
<div class="line"><a name="l00222"></a><span class="lineno">  222</span>&#160;            { base::atomic_add64((int64_t*)&amp;bytsSend_, v); }</div>
<div class="line"><a name="l00223"></a><span class="lineno">  223</span>&#160;            <span class="keywordtype">void</span> addRecvByts(<span class="keywordtype">unsigned</span> <span class="keywordtype">long</span> <span class="keywordtype">long</span> v)</div>
<div class="line"><a name="l00224"></a><span class="lineno">  224</span>&#160;            { base::atomic_add64((int64_t*)&amp;bytsRecv_, v); }</div>
<div class="line"><a name="l00225"></a><span class="lineno">  225</span>&#160;</div>
<div class="line"><a name="l00226"></a><span class="lineno">  226</span>&#160;        <span class="keyword">private</span>:</div>
<div class="line"><a name="l00227"></a><span class="lineno">  227</span>&#160;            <span class="keyword">typedef</span> std::vector&lt;TcpWorkerPtr&gt;   WorkerArray;</div>
<div class="line"><a name="l00228"></a><span class="lineno">  228</span>&#160;            <span class="keyword">typedef</span> boost::unordered_map&lt;int, TcpConnectionPtr&gt; ConnectionMap;</div>
<div class="line"><a name="l00229"></a><span class="lineno">  229</span>&#160;</div>
<div class="line"><a name="l00230"></a><span class="lineno">  230</span>&#160;        <span class="keyword">private</span>:</div>
<div class="line"><a name="l00231"></a><span class="lineno">  231</span>&#160;            <span class="keywordtype">int</span> connIdGen_;                             <span class="comment">/* 连接ID分配 */</span></div>
<div class="line"><a name="l00232"></a><span class="lineno">  232</span>&#160;            <a class="code" href="classsock_1_1net_1_1_tcp_server.html#afb7b447f9f67ed9f1a3f93e15f43b347">State</a> state_;                               <span class="comment">/* 状态 */</span></div>
<div class="line"><a name="l00233"></a><span class="lineno">  233</span>&#160;            EventLoop eventLoop_;                       <span class="comment">/* 事件循环 */</span></div>
<div class="line"><a name="l00234"></a><span class="lineno">  234</span>&#160;            TcpAcceptor acceptor_;                      <span class="comment">/* 连接接收器 */</span></div>
<div class="line"><a name="l00235"></a><span class="lineno">  235</span>&#160;            ConnectionMap connections_;                 <span class="comment">/* 连接表 */</span></div>
<div class="line"><a name="l00236"></a><span class="lineno">  236</span>&#160;            WorkerArray workers_;                       <span class="comment">/* 工作线程数组 */</span></div>
<div class="line"><a name="l00237"></a><span class="lineno">  237</span>&#160;            <a class="code" href="namespacesock_1_1net.html#a2ddc58693b405832076a3d76dc133671">TcpConnectionFactoryPtr</a> connFactory_;       <span class="comment">/* 连接工厂 */</span></div>
<div class="line"><a name="l00238"></a><span class="lineno">  238</span>&#160;</div>
<div class="line"><a name="l00239"></a><span class="lineno">  239</span>&#160;            <span class="comment">// 配置参数</span></div>
<div class="line"><a name="l00240"></a><span class="lineno">  240</span>&#160;            <span class="keywordtype">int</span> cnfWorkers_;                            <span class="comment">/* 配置的工作线程数量 */</span></div>
<div class="line"><a name="l00241"></a><span class="lineno">  241</span>&#160;            base::mtime_t cnfHeartbeatTime_;            <span class="comment">/* 配置的心跳时间 */</span></div>
<div class="line"><a name="l00242"></a><span class="lineno">  242</span>&#160;            base::mtime_t cnfFrameTime_;                <span class="comment">/* 配置的帧时间 */</span></div>
<div class="line"><a name="l00243"></a><span class="lineno">  243</span>&#160;            <span class="keywordtype">size_t</span> cnfConnISSize_;                      <span class="comment">/* 配置的连接输入流大小，默认4KB */</span></div>
<div class="line"><a name="l00244"></a><span class="lineno">  244</span>&#160;            <span class="keywordtype">size_t</span> cnfConnOSSize_;                      <span class="comment">/* 配置的连接输出流大小，默认4KB */</span></div>
<div class="line"><a name="l00245"></a><span class="lineno">  245</span>&#160;</div>
<div class="line"><a name="l00246"></a><span class="lineno">  246</span>&#160;            <span class="comment">// 运行参数</span></div>
<div class="line"><a name="l00247"></a><span class="lineno">  247</span>&#160;            <span class="keywordtype">int</span> realWorkers_;                           <span class="comment">/* 实际工作线程数量 */</span></div>
<div class="line"><a name="l00248"></a><span class="lineno">  248</span>&#160;            <span class="keywordtype">int</span> connLoad_;                              <span class="comment">/* 服务器管理的线程数量 */</span></div>
<div class="line"><a name="l00249"></a><span class="lineno">  249</span>&#160;</div>
<div class="line"><a name="l00250"></a><span class="lineno">  250</span>&#160;            <span class="keywordtype">int</span> connTotal_;                             <span class="comment">/* 总连接数 */</span></div>
<div class="line"><a name="l00251"></a><span class="lineno">  251</span>&#160;            <span class="keyword">volatile</span> <span class="keywordtype">unsigned</span> <span class="keywordtype">long</span> <span class="keywordtype">long</span> bytsSend_;      <span class="comment">/* 发送字节数 */</span></div>
<div class="line"><a name="l00252"></a><span class="lineno">  252</span>&#160;            <span class="keyword">volatile</span> <span class="keywordtype">unsigned</span> <span class="keywordtype">long</span> <span class="keywordtype">long</span> bytsRecv_;      <span class="comment">/* 接收字节数 */</span></div>
<div class="line"><a name="l00253"></a><span class="lineno">  253</span>&#160;</div>
<div class="line"><a name="l00254"></a><span class="lineno">  254</span>&#160;            <span class="comment">// 服务器回调</span></div>
<div class="line"><a name="l00255"></a><span class="lineno">  255</span>&#160;            <a class="code" href="classsock_1_1net_1_1_tcp_acceptor.html#a4f61b7c7e32c3cc975f394efbfced020">TcpAcceptor::PassTcpConnectionPtrRefFunc</a> connectionEstablishedFn_;  <span class="comment">/* 接收到连接回调 */</span></div>
<div class="line"><a name="l00256"></a><span class="lineno">  256</span>&#160;</div>
<div class="line"><a name="l00257"></a><span class="lineno">  257</span>&#160;            <span class="comment">// 连接回调</span></div>
<div class="line"><a name="l00258"></a><span class="lineno">  258</span>&#160;            <a class="code" href="classsock_1_1net_1_1_tcp_connection.html#a836ed49de731537f208e17d07868a9d8">TcpConnection::TcpConnectionReadFunc</a> connReadFn_;                      <span class="comment">/* 读回调 */</span></div>
<div class="line"><a name="l00259"></a><span class="lineno">  259</span>&#160;            <a class="code" href="classsock_1_1net_1_1_tcp_connection.html#ab8951d995ac681b06a8d8dfdadd219aa">TcpConnection::TcpConnectionWriteFunc</a> connWriteFn_;                    <span class="comment">/* 写回调 */</span></div>
<div class="line"><a name="l00260"></a><span class="lineno">  260</span>&#160;            <a class="code" href="classsock_1_1net_1_1_tcp_connection.html#a9d9ea93c3a51141616167ae78c0238ec">TcpConnection::PassTcpConnectionRefFunc</a> connErrorFn_;                  <span class="comment">/* 错误回调 */</span></div>
<div class="line"><a name="l00261"></a><span class="lineno">  261</span>&#160;            <a class="code" href="classsock_1_1net_1_1_tcp_connection.html#a9d9ea93c3a51141616167ae78c0238ec">TcpConnection::PassTcpConnectionRefFunc</a> connCloseFn_;                  <span class="comment">/* 关闭回调 */</span></div>
<div class="line"><a name="l00262"></a><span class="lineno">  262</span>&#160;            <a class="code" href="classsock_1_1net_1_1_tcp_connection.html#a9d9ea93c3a51141616167ae78c0238ec">TcpConnection::PassTcpConnectionRefFunc</a> connHeartbeatFn_;              <span class="comment">/* 心跳回调 */</span></div>
<div class="line"><a name="l00263"></a><span class="lineno">  263</span>&#160;        };</div>
<div class="line"><a name="l00264"></a><span class="lineno">  264</span>&#160;    }</div>
<div class="line"><a name="l00265"></a><span class="lineno">  265</span>&#160;}</div>
<div class="line"><a name="l00266"></a><span class="lineno">  266</span>&#160;</div>
<div class="line"><a name="l00267"></a><span class="lineno">  267</span>&#160;<span class="preprocessor">#endif </span><span class="comment">/* SOCK_NET_TCP_SERVER_H_ */</span><span class="preprocessor"></span></div>
<div class="ttc" id="structsock_1_1net_1_1_tcp_server_1_1_statics_html"><div class="ttname"><a href="structsock_1_1net_1_1_tcp_server_1_1_statics.html">sock::net::TcpServer::Statics</a></div><div class="ttdoc">状态信息 </div><div class="ttdef"><b>Definition:</b> tcp_server.h:61</div></div>
<div class="ttc" id="structsock_1_1net_1_1_tcp_server_1_1_statics_html_a56f1b517fb896b77572d92904e9e1116"><div class="ttname"><a href="structsock_1_1net_1_1_tcp_server_1_1_statics.html#a56f1b517fb896b77572d92904e9e1116">sock::net::TcpServer::Statics::connectionLoad</a></div><div class="ttdeci">int connectionLoad</div><div class="ttdef"><b>Definition:</b> tcp_server.h:71</div></div>
<div class="ttc" id="structsock_1_1net_1_1_tcp_server_1_1_statics_html_acb3fd493d39070b04c5ed59e40025b40"><div class="ttname"><a href="structsock_1_1net_1_1_tcp_server_1_1_statics.html#acb3fd493d39070b04c5ed59e40025b40">sock::net::TcpServer::Statics::workerStatics</a></div><div class="ttdeci">std::vector&lt; TcpWorker::Statics &gt; workerStatics</div><div class="ttdef"><b>Definition:</b> tcp_server.h:75</div></div>
<div class="ttc" id="classsock_1_1net_1_1_tcp_server_html_a8858c03e9c473d4a8313315c267fef28"><div class="ttname"><a href="classsock_1_1net_1_1_tcp_server.html#a8858c03e9c473d4a8313315c267fef28">sock::net::TcpServer::close</a></div><div class="ttdeci">void close(void)</div><div class="ttdoc">关闭服务器 </div><div class="ttdef"><b>Definition:</b> tcp_server.cc:94</div></div>
<div class="ttc" id="classsock_1_1net_1_1_tcp_server_html_a604b0305e6e7c6766af27dbd5a8f2d24"><div class="ttname"><a href="classsock_1_1net_1_1_tcp_server.html#a604b0305e6e7c6766af27dbd5a8f2d24">sock::net::TcpServer::config</a></div><div class="ttdeci">void config(Options optname, void *optval)</div><div class="ttdoc">配置服务器 </div><div class="ttdef"><b>Definition:</b> tcp_server.cc:103</div></div>
<div class="ttc" id="classsock_1_1net_1_1_tcp_server_html_afb7b447f9f67ed9f1a3f93e15f43b347a0216946439f9bc60432110c9e2da378d"><div class="ttname"><a href="classsock_1_1net_1_1_tcp_server.html#afb7b447f9f67ed9f1a3f93e15f43b347a0216946439f9bc60432110c9e2da378d">sock::net::TcpServer::EXIT</a></div><div class="ttdef"><b>Definition:</b> tcp_server.h:55</div></div>
<div class="ttc" id="classsock_1_1net_1_1_tcp_server_html_afb7b447f9f67ed9f1a3f93e15f43b347ae78386eefc569f2c07c58b66cb0751da"><div class="ttname"><a href="classsock_1_1net_1_1_tcp_server.html#afb7b447f9f67ed9f1a3f93e15f43b347ae78386eefc569f2c07c58b66cb0751da">sock::net::TcpServer::READY</a></div><div class="ttdef"><b>Definition:</b> tcp_server.h:52</div></div>
<div class="ttc" id="classsock_1_1net_1_1_tcp_server_html_aa44d4d1608416e7fca8935090c5ef6ca"><div class="ttname"><a href="classsock_1_1net_1_1_tcp_server.html#aa44d4d1608416e7fca8935090c5ef6ca">sock::net::TcpServer::getStatics</a></div><div class="ttdeci">void getStatics(Statics &amp;statics)</div><div class="ttdoc">获取服务器状态数据 </div><div class="ttdef"><b>Definition:</b> tcp_server.cc:219</div></div>
<div class="ttc" id="classsock_1_1net_1_1_tcp_server_html_abec9ec73a9e95554ec1dd46ebcebb26ca4b64346c3e4b3ae76cf612e103d98638"><div class="ttname"><a href="classsock_1_1net_1_1_tcp_server.html#abec9ec73a9e95554ec1dd46ebcebb26ca4b64346c3e4b3ae76cf612e103d98638">sock::net::TcpServer::FRAME_TIME</a></div><div class="ttdef"><b>Definition:</b> tcp_server.h:42</div></div>
<div class="ttc" id="structsock_1_1net_1_1_event_loop_1_1_statics_html"><div class="ttname"><a href="structsock_1_1net_1_1_event_loop_1_1_statics.html">sock::net::EventLoop::Statics</a></div><div class="ttdoc">状态 </div><div class="ttdef"><b>Definition:</b> event_loop.h:42</div></div>
<div class="ttc" id="structsock_1_1net_1_1_tcp_server_1_1_statics_html_a3eadb0e652b53b813a432931b0212cd0"><div class="ttname"><a href="structsock_1_1net_1_1_tcp_server_1_1_statics.html#a3eadb0e652b53b813a432931b0212cd0">sock::net::TcpServer::Statics::connections</a></div><div class="ttdeci">int connections</div><div class="ttdef"><b>Definition:</b> tcp_server.h:66</div></div>
<div class="ttc" id="tcp__connection_8h_html"><div class="ttname"><a href="tcp__connection_8h.html">tcp_connection.h</a></div></div>
<div class="ttc" id="classsock_1_1net_1_1_tcp_connection_html_ab8951d995ac681b06a8d8dfdadd219aa"><div class="ttname"><a href="classsock_1_1net_1_1_tcp_connection.html#ab8951d995ac681b06a8d8dfdadd219aa">sock::net::TcpConnection::TcpConnectionWriteFunc</a></div><div class="ttdeci">boost::function&lt; void(TcpConnection &amp;, TcpConnectionOutputStream &amp;)&gt; TcpConnectionWriteFunc</div><div class="ttdef"><b>Definition:</b> tcp_connection.h:32</div></div>
<div class="ttc" id="structsock_1_1net_1_1_tcp_server_1_1_config_html_a9c3eb6b189903fa17f12e44ea5cd78e7"><div class="ttname"><a href="structsock_1_1net_1_1_tcp_server_1_1_config.html#a9c3eb6b189903fa17f12e44ea5cd78e7">sock::net::TcpServer::Config::connectionOsSize</a></div><div class="ttdeci">size_t connectionOsSize</div><div class="ttdef"><b>Definition:</b> tcp_server.h:87</div></div>
<div class="ttc" id="classsock_1_1net_1_1_tcp_server_html_abec9ec73a9e95554ec1dd46ebcebb26cad2dd1e3c9592315e4a98df0519c3b299"><div class="ttname"><a href="classsock_1_1net_1_1_tcp_server.html#abec9ec73a9e95554ec1dd46ebcebb26cad2dd1e3c9592315e4a98df0519c3b299">sock::net::TcpServer::CONN_OSSIZE</a></div><div class="ttdef"><b>Definition:</b> tcp_server.h:44</div></div>
<div class="ttc" id="structsock_1_1net_1_1_tcp_server_1_1_config_html_a12200d1af83c28b39456346cbb4f8dd7"><div class="ttname"><a href="structsock_1_1net_1_1_tcp_server_1_1_config.html#a12200d1af83c28b39456346cbb4f8dd7">sock::net::TcpServer::Config::connectionIsSize</a></div><div class="ttdeci">size_t connectionIsSize</div><div class="ttdef"><b>Definition:</b> tcp_server.h:86</div></div>
<div class="ttc" id="classsock_1_1net_1_1_tcp_acceptor_html_a4f61b7c7e32c3cc975f394efbfced020"><div class="ttname"><a href="classsock_1_1net_1_1_tcp_acceptor.html#a4f61b7c7e32c3cc975f394efbfced020">sock::net::TcpAcceptor::PassTcpConnectionPtrRefFunc</a></div><div class="ttdeci">boost::function&lt; void(TcpConnectionPtr &amp;)&gt; PassTcpConnectionPtrRefFunc</div><div class="ttdef"><b>Definition:</b> tcp_acceptor.h:28</div></div>
<div class="ttc" id="namespacesock_1_1net_html_ac7ab8c7fe4e8e023f2fea799b74122ed"><div class="ttname"><a href="namespacesock_1_1net.html#ac7ab8c7fe4e8e023f2fea799b74122ed">sock::net::TcpConnectionPtr</a></div><div class="ttdeci">boost::shared_ptr&lt; TcpConnection &gt; TcpConnectionPtr</div><div class="ttdef"><b>Definition:</b> tcp_connection.h:158</div></div>
<div class="ttc" id="classsock_1_1net_1_1_tcp_server_html_a226792a6bb7cccdb4eb6dfdf8851326c"><div class="ttname"><a href="classsock_1_1net_1_1_tcp_server.html#a226792a6bb7cccdb4eb6dfdf8851326c">sock::net::TcpServer::~TcpServer</a></div><div class="ttdeci">~TcpServer(void)</div><div class="ttdef"><b>Definition:</b> tcp_server.cc:44</div></div>
<div class="ttc" id="structsock_1_1net_1_1_tcp_server_1_1_statics_html_aed675a9fca0ac458c12e579ea5fecbd6"><div class="ttname"><a href="structsock_1_1net_1_1_tcp_server_1_1_statics.html#aed675a9fca0ac458c12e579ea5fecbd6">sock::net::TcpServer::Statics::workers</a></div><div class="ttdeci">int workers</div><div class="ttdef"><b>Definition:</b> tcp_server.h:65</div></div>
<div class="ttc" id="classsock_1_1net_1_1_tcp_server_html_ad6d1a8405d96f2479c297918c396d212"><div class="ttname"><a href="classsock_1_1net_1_1_tcp_server.html#ad6d1a8405d96f2479c297918c396d212">sock::net::TcpServer::TcpServer</a></div><div class="ttdeci">TcpServer(void)</div><div class="ttdef"><b>Definition:</b> tcp_server.cc:20</div></div>
<div class="ttc" id="structsock_1_1net_1_1_tcp_server_1_1_statics_html_aaed29ec6015c7b06f1cc21ba46ce387d"><div class="ttname"><a href="structsock_1_1net_1_1_tcp_server_1_1_statics.html#aaed29ec6015c7b06f1cc21ba46ce387d">sock::net::TcpServer::Statics::eventLoopStatics</a></div><div class="ttdeci">EventLoop::Statics eventLoopStatics</div><div class="ttdef"><b>Definition:</b> tcp_server.h:72</div></div>
<div class="ttc" id="classsock_1_1net_1_1_tcp_server_html_abec9ec73a9e95554ec1dd46ebcebb26ca0eb2364f1f8f1ee1f86670d030370bb3"><div class="ttname"><a href="classsock_1_1net_1_1_tcp_server.html#abec9ec73a9e95554ec1dd46ebcebb26ca0eb2364f1f8f1ee1f86670d030370bb3">sock::net::TcpServer::CONN_ISSIZE</a></div><div class="ttdef"><b>Definition:</b> tcp_server.h:43</div></div>
<div class="ttc" id="classsock_1_1net_1_1_tcp_server_html_a4cd23b2b8566abc9d4f167b2c0488095"><div class="ttname"><a href="classsock_1_1net_1_1_tcp_server.html#a4cd23b2b8566abc9d4f167b2c0488095">sock::net::TcpServer::setConnectionFactory</a></div><div class="ttdeci">void setConnectionFactory(TcpConnectionFactoryPtr factory)</div><div class="ttdoc">设置连接工厂 </div><div class="ttdef"><b>Definition:</b> tcp_server.h:125</div></div>
<div class="ttc" id="structsock_1_1net_1_1_tcp_server_1_1_config_html_a6591de0bfd776b4496665c89c7a0bd82"><div class="ttname"><a href="structsock_1_1net_1_1_tcp_server_1_1_config.html#a6591de0bfd776b4496665c89c7a0bd82">sock::net::TcpServer::Config::workers</a></div><div class="ttdeci">int workers</div><div class="ttdef"><b>Definition:</b> tcp_server.h:83</div></div>
<div class="ttc" id="structsock_1_1net_1_1_tcp_server_1_1_config_html_a854b878563895cec9e925d50944c2bc1"><div class="ttname"><a href="structsock_1_1net_1_1_tcp_server_1_1_config.html#a854b878563895cec9e925d50944c2bc1">sock::net::TcpServer::Config::heartbeatTime</a></div><div class="ttdeci">base::mtime_t heartbeatTime</div><div class="ttdef"><b>Definition:</b> tcp_server.h:85</div></div>
<div class="ttc" id="classsock_1_1net_1_1_tcp_worker_html"><div class="ttname"><a href="classsock_1_1net_1_1_tcp_worker.html">sock::net::TcpWorker</a></div><div class="ttdef"><b>Definition:</b> tcp_worker.h:25</div></div>
<div class="ttc" id="classsock_1_1net_1_1_tcp_server_html_ab68be9fc6db7094c2b6ca6b1650399e3"><div class="ttname"><a href="classsock_1_1net_1_1_tcp_server.html#ab68be9fc6db7094c2b6ca6b1650399e3">sock::net::TcpServer::setConnectionReadFN</a></div><div class="ttdeci">void setConnectionReadFN(TcpConnection::TcpConnectionReadFunc fn)</div><div class="ttdoc">设置读回调 </div><div class="ttdef"><b>Definition:</b> tcp_server.h:144</div></div>
<div class="ttc" id="classsock_1_1net_1_1_tcp_connection_html"><div class="ttname"><a href="classsock_1_1net_1_1_tcp_connection.html">sock::net::TcpConnection</a></div><div class="ttdoc">网络连接 </div><div class="ttdef"><b>Definition:</b> tcp_connection.h:27</div></div>
<div class="ttc" id="classsock_1_1net_1_1_tcp_server_html_add5343d5b2e2f7a7536fdb88a9dd4033"><div class="ttname"><a href="classsock_1_1net_1_1_tcp_server.html#add5343d5b2e2f7a7536fdb88a9dd4033">sock::net::TcpServer::setConnectionHeartbeatFN</a></div><div class="ttdeci">void setConnectionHeartbeatFN(TcpConnection::PassTcpConnectionRefFunc fn)</div><div class="ttdoc">设置心跳回调 </div><div class="ttdef"><b>Definition:</b> tcp_server.h:176</div></div>
<div class="ttc" id="classsock_1_1net_1_1_tcp_server_html_ae950d0e397409f17f8eaeb2d191abdd6"><div class="ttname"><a href="classsock_1_1net_1_1_tcp_server.html#ae950d0e397409f17f8eaeb2d191abdd6">sock::net::TcpServer::setConnectionWriteFN</a></div><div class="ttdeci">void setConnectionWriteFN(TcpConnection::TcpConnectionWriteFunc fn)</div><div class="ttdoc">设置写回调 </div><div class="ttdef"><b>Definition:</b> tcp_server.h:152</div></div>
<div class="ttc" id="classsock_1_1net_1_1_tcp_server_html_afb7b447f9f67ed9f1a3f93e15f43b347add196db3e514c0fa131ec4b2e36ec25b"><div class="ttname"><a href="classsock_1_1net_1_1_tcp_server.html#afb7b447f9f67ed9f1a3f93e15f43b347add196db3e514c0fa131ec4b2e36ec25b">sock::net::TcpServer::RUNNING</a></div><div class="ttdef"><b>Definition:</b> tcp_server.h:53</div></div>
<div class="ttc" id="classsock_1_1net_1_1_tcp_server_html_a6fc6f8dc248d7338478316126bf37319"><div class="ttname"><a href="classsock_1_1net_1_1_tcp_server.html#a6fc6f8dc248d7338478316126bf37319">sock::net::TcpServer::setConnectionCloseFN</a></div><div class="ttdeci">void setConnectionCloseFN(TcpConnection::PassTcpConnectionRefFunc fn)</div><div class="ttdoc">设置关闭回调 </div><div class="ttdef"><b>Definition:</b> tcp_server.h:168</div></div>
<div class="ttc" id="classsock_1_1net_1_1_tcp_server_html_abec9ec73a9e95554ec1dd46ebcebb26ca52b8a6d182527f5cbf89ce8fcebd6b6b"><div class="ttname"><a href="classsock_1_1net_1_1_tcp_server.html#abec9ec73a9e95554ec1dd46ebcebb26ca52b8a6d182527f5cbf89ce8fcebd6b6b">sock::net::TcpServer::HEARTBEAT_TIME</a></div><div class="ttdef"><b>Definition:</b> tcp_server.h:41</div></div>
<div class="ttc" id="event__loop_8h_html"><div class="ttname"><a href="event__loop_8h.html">event_loop.h</a></div></div>
<div class="ttc" id="structsock_1_1net_1_1_tcp_server_1_1_statics_html_a36efcda737e698c67fca2d6ffc3952da"><div class="ttname"><a href="structsock_1_1net_1_1_tcp_server_1_1_statics.html#a36efcda737e698c67fca2d6ffc3952da">sock::net::TcpServer::Statics::bytsRecv</a></div><div class="ttdeci">unsigned long long bytsRecv</div><div class="ttdef"><b>Definition:</b> tcp_server.h:68</div></div>
<div class="ttc" id="classsock_1_1net_1_1_tcp_connection_html_a836ed49de731537f208e17d07868a9d8"><div class="ttname"><a href="classsock_1_1net_1_1_tcp_connection.html#a836ed49de731537f208e17d07868a9d8">sock::net::TcpConnection::TcpConnectionReadFunc</a></div><div class="ttdeci">boost::function&lt; void(TcpConnection &amp;, TcpConnectionInputStream &amp;)&gt; TcpConnectionReadFunc</div><div class="ttdef"><b>Definition:</b> tcp_connection.h:31</div></div>
<div class="ttc" id="classsock_1_1net_1_1_tcp_server_html_afb7b447f9f67ed9f1a3f93e15f43b347ad1b2046ce4c56bad7b7a9a090a7e2021"><div class="ttname"><a href="classsock_1_1net_1_1_tcp_server.html#afb7b447f9f67ed9f1a3f93e15f43b347ad1b2046ce4c56bad7b7a9a090a7e2021">sock::net::TcpServer::EXITING</a></div><div class="ttdef"><b>Definition:</b> tcp_server.h:54</div></div>
<div class="ttc" id="atomic_8h_html"><div class="ttname"><a href="atomic_8h.html">atomic.h</a></div></div>
<div class="ttc" id="namespacesock_html"><div class="ttname"><a href="namespacesock.html">sock</a></div><div class="ttdef"><b>Definition:</b> atomic.h:17</div></div>
<div class="ttc" id="mutex_8h_html"><div class="ttname"><a href="mutex_8h.html">mutex.h</a></div></div>
<div class="ttc" id="tcp__worker_8h_html"><div class="ttname"><a href="tcp__worker_8h.html">tcp_worker.h</a></div></div>
<div class="ttc" id="structsock_1_1net_1_1_tcp_server_1_1_statics_html_ab4487c2d93a326630fbbe9c5c9f9866a"><div class="ttname"><a href="structsock_1_1net_1_1_tcp_server_1_1_statics.html#ab4487c2d93a326630fbbe9c5c9f9866a">sock::net::TcpServer::Statics::bytsSend</a></div><div class="ttdeci">unsigned long long bytsSend</div><div class="ttdef"><b>Definition:</b> tcp_server.h:67</div></div>
<div class="ttc" id="tcp__connection__factory_8h_html"><div class="ttname"><a href="tcp__connection__factory_8h.html">tcp_connection_factory.h</a></div></div>
<div class="ttc" id="namespacesock_1_1net_html_a2ddc58693b405832076a3d76dc133671"><div class="ttname"><a href="namespacesock_1_1net.html#a2ddc58693b405832076a3d76dc133671">sock::net::TcpConnectionFactoryPtr</a></div><div class="ttdeci">boost::shared_ptr&lt; TcpConnectionFactory &gt; TcpConnectionFactoryPtr</div><div class="ttdef"><b>Definition:</b> tcp_connection_factory.h:39</div></div>
<div class="ttc" id="classsock_1_1net_1_1_tcp_server_html_a0641cbef81380437d1c420e9883a9840"><div class="ttname"><a href="classsock_1_1net_1_1_tcp_server.html#a0641cbef81380437d1c420e9883a9840">sock::net::TcpServer::setConnectionErrorFN</a></div><div class="ttdeci">void setConnectionErrorFN(TcpConnection::PassTcpConnectionRefFunc fn)</div><div class="ttdoc">设置错误回调 </div><div class="ttdef"><b>Definition:</b> tcp_server.h:160</div></div>
<div class="ttc" id="classsock_1_1net_1_1_tcp_server_html"><div class="ttname"><a href="classsock_1_1net_1_1_tcp_server.html">sock::net::TcpServer</a></div><div class="ttdef"><b>Definition:</b> tcp_server.h:29</div></div>
<div class="ttc" id="classsock_1_1net_1_1_tcp_server_html_abec9ec73a9e95554ec1dd46ebcebb26cae14a3e48f9466cf5533f6501065e5d8f"><div class="ttname"><a href="classsock_1_1net_1_1_tcp_server.html#abec9ec73a9e95554ec1dd46ebcebb26cae14a3e48f9466cf5533f6501065e5d8f">sock::net::TcpServer::WORKER_NUM</a></div><div class="ttdef"><b>Definition:</b> tcp_server.h:40</div></div>
<div class="ttc" id="classsock_1_1net_1_1_tcp_server_html_ac1ca3065af98af784c65622431db16b5"><div class="ttname"><a href="classsock_1_1net_1_1_tcp_server.html#ac1ca3065af98af784c65622431db16b5">sock::net::TcpServer::getConfig</a></div><div class="ttdeci">void getConfig(Config &amp;config)</div><div class="ttdoc">获取服务器当前配置 </div><div class="ttdef"><b>Definition:</b> tcp_server.cc:236</div></div>
<div class="ttc" id="structsock_1_1net_1_1_tcp_server_1_1_statics_html_aa5eedbb8f4e72c3a1f18e316d14d9fb3"><div class="ttname"><a href="structsock_1_1net_1_1_tcp_server_1_1_statics.html#aa5eedbb8f4e72c3a1f18e316d14d9fb3">sock::net::TcpServer::Statics::connectionIdGen</a></div><div class="ttdeci">int connectionIdGen</div><div class="ttdef"><b>Definition:</b> tcp_server.h:64</div></div>
<div class="ttc" id="tcp__acceptor_8h_html"><div class="ttname"><a href="tcp__acceptor_8h.html">tcp_acceptor.h</a></div></div>
<div class="ttc" id="structsock_1_1net_1_1_tcp_server_1_1_config_html_a735d7b1eb8613f87f4c2fb68b5c02bee"><div class="ttname"><a href="structsock_1_1net_1_1_tcp_server_1_1_config.html#a735d7b1eb8613f87f4c2fb68b5c02bee">sock::net::TcpServer::Config::frameTime</a></div><div class="ttdeci">base::mtime_t frameTime</div><div class="ttdef"><b>Definition:</b> tcp_server.h:84</div></div>
<div class="ttc" id="structsock_1_1net_1_1_tcp_server_1_1_config_html"><div class="ttname"><a href="structsock_1_1net_1_1_tcp_server_1_1_config.html">sock::net::TcpServer::Config</a></div><div class="ttdoc">配置数据 </div><div class="ttdef"><b>Definition:</b> tcp_server.h:81</div></div>
<div class="ttc" id="classsock_1_1net_1_1_tcp_server_html_abec9ec73a9e95554ec1dd46ebcebb26c"><div class="ttname"><a href="classsock_1_1net_1_1_tcp_server.html#abec9ec73a9e95554ec1dd46ebcebb26c">sock::net::TcpServer::Options</a></div><div class="ttdeci">Options</div><div class="ttdoc">服务器配置参数 </div><div class="ttdef"><b>Definition:</b> tcp_server.h:38</div></div>
<div class="ttc" id="classsock_1_1net_1_1_tcp_server_html_a750bc64764b1277beee95ba9231f0f08"><div class="ttname"><a href="classsock_1_1net_1_1_tcp_server.html#a750bc64764b1277beee95ba9231f0f08">sock::net::TcpServer::run</a></div><div class="ttdeci">void run(void)</div><div class="ttdoc">运行服务器 </div><div class="ttdef"><b>Definition:</b> tcp_server.cc:85</div></div>
<div class="ttc" id="classsock_1_1net_1_1_tcp_connection_html_a9d9ea93c3a51141616167ae78c0238ec"><div class="ttname"><a href="classsock_1_1net_1_1_tcp_connection.html#a9d9ea93c3a51141616167ae78c0238ec">sock::net::TcpConnection::PassTcpConnectionRefFunc</a></div><div class="ttdeci">boost::function&lt; void(TcpConnection &amp;)&gt; PassTcpConnectionRefFunc</div><div class="ttdef"><b>Definition:</b> tcp_connection.h:30</div></div>
<div class="ttc" id="classsock_1_1net_1_1_tcp_server_html_afb7b447f9f67ed9f1a3f93e15f43b347"><div class="ttname"><a href="classsock_1_1net_1_1_tcp_server.html#afb7b447f9f67ed9f1a3f93e15f43b347">sock::net::TcpServer::State</a></div><div class="ttdeci">State</div><div class="ttdoc">状态 </div><div class="ttdef"><b>Definition:</b> tcp_server.h:50</div></div>
<div class="ttc" id="classsock_1_1net_1_1_tcp_server_html_afc40c8a3ac309ae92182de21a014d4cd"><div class="ttname"><a href="classsock_1_1net_1_1_tcp_server.html#afc40c8a3ac309ae92182de21a014d4cd">sock::net::TcpServer::open</a></div><div class="ttdeci">bool open(const char *addr, int port, int backlog)</div><div class="ttdoc">启动服务器 </div><div class="ttdef"><b>Definition:</b> tcp_server.cc:49</div></div>
<div class="ttc" id="classsock_1_1net_1_1_tcp_server_html_aed1da477683c9942e4c04f891b0050c5"><div class="ttname"><a href="classsock_1_1net_1_1_tcp_server.html#aed1da477683c9942e4c04f891b0050c5">sock::net::TcpServer::setConnectionEstablishedFN</a></div><div class="ttdeci">void setConnectionEstablishedFN(TcpAcceptor::PassTcpConnectionPtrRefFunc fn)</div><div class="ttdoc">设置新连接回调 </div><div class="ttdef"><b>Definition:</b> tcp_server.h:184</div></div>
</div><!-- fragment --></div><!-- contents -->
<!-- start footer part -->
<hr class="footer"/><address class="footer"><small>
Generated by &#160;<a href="http://www.doxygen.org/index.html">
<img class="footer" src="doxygen.png" alt="doxygen"/>
</a> 1.8.10
</small></address>
</body>
</html>
